#!/bin/bash

getexts () {
  #splitext | sort | uniq -c
  #grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq -c | sort -n
  path '$ext' | sort | uniq -c | sort -n
}

listfiles () {
  #l lltype -1
  find "${@:-.}" -type f
}

if [ -z "$*" ]; then
  cat | getexts
else
  listfiles "$@" | getexts
fi

